package com.tcm.service;

import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import com.tcm.entity.User;
import com.tcm.exception.EntityInvalidException;
import com.tcm.exception.UserNotExistException;
import com.tcm.exception.WxUserNotBindException;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

/**
 * 权限业务类
 * @author Guqier
 * @version 1.0
 * @date 2023/7/2 13:35
 */
public interface AuthService {


    Map<String, String> login(User user, Integer[] allowUserType) throws UserNotExistException, EntityInvalidException;

    boolean logout(String accessToken);

    Map<String, String> refreshToken(Long userId, String account, String accessToken);

    Map<String, String> generateAuthCode();

    boolean verifyAuthCode(String uuid, String code);

    Map<String, String> wxLogin(WxMaJscode2SessionResult session, Integer[] allowUserType) throws WxUserNotBindException;

    @Transactional
    boolean miniAppBind(String openid, Long userId);

    /**
     * 解除微信绑定
     * @param userId 当前用户ID
     * @return 处理结果
     */
    @Transactional
    boolean miniAppUnbind(Long userId);
}
